package com.zprmb.udzt;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zprmb.udzt.util.BitmapUtils;

public class Bind_Bank_Gift extends BaseActivity implements OnClickListener{
	private TextView tv_coupon_rate1,tv_coupon_rate2,tv_coupon_rate3,tv_time1,tv_time2,tv_time3;
	private ImageView img_xx;
	private Button btn_mycoupon;
	private LinearLayout li_bg;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.bind_gift);
		initView();
	}
	@SuppressLint("NewApi")
	private void initView() {
		// TODO Auto-generated method stub
		tv_coupon_rate1=(TextView)findViewById(R.id.tv_coupon_rate1);
		tv_coupon_rate2=(TextView)findViewById(R.id.tv_coupon_rate2);
		tv_coupon_rate3=(TextView)findViewById(R.id.tv_coupon_rate3);
		tv_time1=(TextView)findViewById(R.id.tv_time1);
		tv_time2=(TextView)findViewById(R.id.tv_time2);
		tv_time3=(TextView)findViewById(R.id.tv_time3);
		li_bg=(LinearLayout)findViewById(R.id.li_bg);
		img_xx=(ImageView)findViewById(R.id.img_xx);
		btn_mycoupon=(Button)findViewById(R.id.btn_mycoupon);
		tv_coupon_rate1.setText(getIntent().getStringExtra("coupon1")+"%");
		tv_coupon_rate2.setText(getIntent().getStringExtra("coupon2")+"%");
		tv_coupon_rate3.setText(getIntent().getStringExtra("coupon3")+"%");
		tv_time1.setText("有效期"+getIntent().getStringExtra("rate1")+"天");
		tv_time2.setText("有效期"+getIntent().getStringExtra("rate2")+"天");
		tv_time3.setText("有效期"+getIntent().getStringExtra("rate3")+"天");
		li_bg.setBackground(new BitmapDrawable(BitmapUtils.readBitMap(Bind_Bank_Gift.this, R.drawable.dlb)));
		btn_mycoupon.setOnClickListener(this);
		img_xx.setOnClickListener(this);
//		Log.e("gift1", getIntent().getStringExtra("rate1")+"天");
//		Log.e("gift2", getIntent().getStringExtra("rate2")+"天");
//		Log.e("gift3", getIntent().getStringExtra("rate3")+"天");
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.img_xx:
			finish();
			break;
		case R.id.btn_mycoupon:
			Intent intent=new Intent(Bind_Bank_Gift.this,MyCoupon.class);
			intent.putExtra("flag", 1);
			startActivity(intent);
			break;
		}
		
	}

}
